package nl.hanze.designpatterns.Domain;

import java.io.Serializable;
import java.util.ArrayList;

public class Question implements Serializable{
    public Question parent = null;
    private ArrayList<Question> questions = new ArrayList<Question>();
    private ArrayList<Answer> awnsers = new ArrayList<Answer>();

    private String text = "";

    public Question() {

    }

    public Question(Question parent) {
        parent.add(this);

    }

    //questions

    public Question add(Question question) {
        question.parent = this;
        this.questions.add(question);
        return question;
    }

    public ArrayList<Question> getQuestions() {
        return questions;
    }

    public Answer add(Answer answer) {
        answer.parent = this;
        this.awnsers.add(answer);
        return answer;
    }

    public ArrayList<Answer> getAnswers() {
        return awnsers;
    }

    //text

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    @Override
    public String toString() {
        return getText();
    }
}
